<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
  </head>
  <body>
    <canvas id="canvas" width="150" height="150"></canvas>
    <button id="draw">Draw</button>
  </body>


  <script>
  function draw() {
  const canvas = document.getElementById("canvas");
    if (canvas.getContext) {
      const ctx = canvas.getContext("2d");

      ctx.fillRect(25, 25, 100, 100);
      ctx.clearRect(45, 45, 60, 60);
      ctx.strokeRect(50, 50, 50, 50);
    }
  }
  document.getElementById('draw').addEventListener('click', draw);
  </script>
</html>
